/**
 * 
 */
package com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.useroption;

import com.alstudio.module.xmpp.protocol.xmpp.data.VauthData;
import com.alstudio.module.xmpp.protocol.xmpp.packact.ALXmppDomainConfig;
import com.alstudio.module.xmpp.protocol.xmpp.packact.IQNameSpace;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.AlXmlTag;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.BaseIQTemplate;

/**
 * 请求V认证
 * @author alonso lee
 *
 */
public class StartVauthIQCreator extends BaseIQTemplate {
	
	private VauthData data;
	
	/**
	 * 
	 */
	public StartVauthIQCreator(VauthData data,String domain) {
		// TODO Auto-generated constructor stub
		this.data = data;
		this.domain = domain;
	}

	/* (non-Javadoc)
	 * @see com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.BaseIQTemplate#getIQXml()
	 */
	@Override
	public String getIQXml() {

		to = ALXmppDomainConfig.getALXmppDomainConfig().getDomainByNameSpace(
				IQNameSpace.NS_START_VAUTH);
		mALIQCreator.setTo(to + domain);
		mALIQCreator.setNs(IQNameSpace.NS_START_VAUTH);
		mALIQCreator.setType(IQ_TYPE_SET);
		
		//大图
		AlXmlTag tag = new AlXmlTag("url");
		tag.setText(data.getUrl());
		tagList.add(tag);
		
		//小兔
		tag = new AlXmlTag("smallurl");
		tag.setText(data.getSmallUrl());
		tagList.add(tag);
		
		//小兔
		tag = new AlXmlTag("vavatar");
		tag.setText(data.getSelectPhotoFileid());
		tag.setAtt("index", data.getIndex());
		tagList.add(tag);

		String xml = "";
		try {
			xml = mALIQCreator.getXml();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return xml;
	
	}


}
